package com.vote.service.impl;

import com.vote.dao.BrandMapper;
import com.vote.pojo.Brand;
import com.vote.pojo.BrandVo;
import com.vote.service.BrandService;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Administrator on 2017-08-04.
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class BrandService implements BrandService {

    @Resource
    private BrandMapper brandMapper;

    //得到所有品牌记录
    public List<Brand> getAllBrand(){
        List<Brand> brandList=brandMapper.selectByExample(null);
        return brandList;
    }

    //根据品牌分类分页查询品牌记录
    public List<Brand> getBrandByTypeLimit(BrandVo brandVo){
        List<Brand> brandList=brandMapper.getBrandByTypeLimit(brandVo);
        return brandList;
    }

    //根据品牌分类查询品牌记录总数
    public int getBrandCountByType(@Param(value="brandType") String brandType){
        int count=brandMapper.getBrandCountByType(brandType);
        return count;
    }
}
